package LearnRandom;

import java.util.Random;

public class Main {
    public static void main(String[] args) {
        System.out.println(getRandom(5, 10));
    }

    //生成指定范围内的随机整数，
    static int getRandom(int min,int max){
        if (max <= min) {
            // 还没学到Exception，后面再补
            return -1;
        }
        
        Random r = new Random();
        int n = min + r.nextInt(max-min);
        return n;
    }
}

